package com;

public class Producer implements  Runnable {//定义一个送奶工类
    private  Box b;//定义一个变量，牛奶对象

    public Producer(Box b) {//牛奶对象作为参数
        this.b = b;//赋值给本类
    }

    @Override
    public void run() {//定义本类的方法。遍历1到5的数字并赋值给奶箱的milke
        for (int i = 1; i <=5 ; i++) {//
            b.putMilke(i);//调用送奶方法给奶箱送奶
        }
    }
}
